﻿Public Class OptionsUI
    Private Const WindowTitle As String = "Options"
    Private Const uxContainer_Text As String = "Capture options"
    Private Const uxFullscreen_text As String = "&Full Screen"
    Private Const uxCaptureRectangle_Text As String = "&Rectangle Shape"
    Private Const uxSelectedWindow_Text As String = "&Selected Window"
    Private Const uxOk_Text As String = "&OK"
    Private Const uxCancel_Text As String = "&Cancel"
    Private Sub LocalizeUI()
        Me.Text = WindowTitle
        Me.uxCaptureRectangle.Text = uxCaptureRectangle_Text
        Me.uxContainer.Text = uxContainer_Text
        Me.uxFullScreen.Text = uxFullscreen_text
        Me.uxOk.Text = uxOk_Text
        Me.uxCancel.Text = uxCancel_Text
    End Sub

    Private Sub OptionsUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.LocalizeUI()
        Me.LoadSettings()
    End Sub
    Private Sub LoadSettings()
        Dim currentSettings As Settings = ConfigSettings.ReadSettings
        Select Case currentSettings.OptionType
            Case ConfigSettings.CaptureType.FullScreen
                Me.uxFullScreen.Checked = True
            Case ConfigSettings.CaptureType.Rectangle
                Me.uxCaptureRectangle.Checked = True
            Case ConfigSettings.CaptureType.SelectedWindow
                'do nothing. To be implemented
        End Select
    End Sub
    Private Sub uxOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uxOk.Click
        Dim currentSettings As New Settings
        If Me.uxCaptureRectangle.Checked Then
            currentSettings.OptionType = ConfigSettings.CaptureType.Rectangle
        ElseIf Me.uxFullScreen.Checked Then
            currentSettings.OptionType = ConfigSettings.CaptureType.FullScreen
        Else
            'do nothing. To be implemented
        End If
        ConfigSettings.SaveSettings(currentSettings)
        Me.Close()
    End Sub

    Private Sub uxCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uxCancel.Click
        Me.Close()
    End Sub
End Class